
/*
 * BroadcastMsg.java
 * 广播消息。记录消息的发送者及内容，内容仅限一行，但可以有空白符号。
 */
import java.io.*;

public class BroadcastMsg implements Serializable {
    public BroadcastMsg(String sender, String msg)
    {
        this.sender = sender;
        this.msg = msg;
    }
    
    public BroadcastMsg(String msg)
    {
        this(null, msg);
    }
    
    @Override
    public String toString()
    {
        return sender + " 说：[" + msg + "]";
    }
    
    public String get_sender()
    {
        return sender;
    }
    
    public String set_sender(String sender)
    {
        String previous = this.sender;
        this.sender = sender;
        return previous;
    }
    
    private String sender, msg;
}